#ifndef __GRAPH_H
#define __GRAPH_H

typedef unsigned int uint;
struct Vertex;
struct Edge;
struct Graph;
typedef struct Edge * pEdge;
typedef struct Vertex * pVertex;
typedef struct Graph* pGraph;

struct Edge {
	uint id;
	float weight;
	pEdge next;
};

struct Vertex {
	uint id;
	int inDegree;
	pEdge edge; // first Edge
};

struct Graph {
	int capacity;
	int nVertex;
	pVertex* vertexList;
};


pGraph initGraph(int capacity);
pVertex createVertex(uint id);
pEdge createEdge(uint id, float weight);
pVertex findVertex(pGraph graph, uint id);
void addVertex(pGraph graph, uint id);
// pEdge findEdges(pGraph graph, uint id);
void printGraph(pGraph graph);
void printVertex(pVertex vertex);
void addEdge(pGraph graph, uint id1, uint id2, float weight);
void dropVertex(pGraph graph, uint id);
pVertex findZeroInDegree(pGraph graph);
void topSort(pGraph graph); // topology sort

void unWeightShortPath(pGraph graph, uint fromId) ; //unweighted shortest path
void weightShortPath(pGraph graph, uint fromId) ; //unweighted shortest path, dijkstra

#endif